Skip to content

feat(stripe): modern paymentintents checkout (hosted + embedded)#238

Open
Tarunkumar0601 wants to merge 3 commits into
frappe:developfrom
aerele:feat/stripe-payment-intents-checkout
Open

feat(stripe): modern paymentintents checkout (hosted + embedded)#238
Tarunkumar0601 wants to merge 3 commits into
frappe:developfrom
aerele:feat/stripe-payment-intents-checkout

Conversation

@Tarunkumar0601

Copy link
Copy Markdown

Replaces the deprecated Charges/token flow with PaymentIntents (SCA / 3-D Secure ready).

  • Hosted Checkout (default): redirect to a Stripe-hosted payment page
  • Embedded Elements: on-site card form via PaymentElement
  • Handles 3-D Secure (requires_action) instead of hard-failing
  • Idempotent finalisation shared by the synchronous return and the success page

Selectable per account via checkout_mode. Depends on feat/stripe-shared-infra.

Backport Needed : V15 & V16

@Tarunkumar0601 Tarunkumar0601 marked this pull request as ready for review July 1, 2026 10:33
@mergify

mergify Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@greptile-apps

greptile-apps Bot commented Jul 1, 2026

Copy link
Copy Markdown

Confidence Score: 4/5

Safe to merge after reviewing the two non-blocking findings; no critical breakage in the payment or authorization paths.

Every security hole flagged in earlier rounds has been closed. The two remaining observations are: (1) billing_interval_count is not clamped to >= 1 in the subscription-sync path, causing silent Stripe API failures for plans with an unset count; (2) the embedded flow leaves the first Integration Request permanently Pending while a second carries the settlement — a data-quality issue that could produce confusing webhook interactions once the shared-infra webhook handler lands. Neither affects the money path in the current PR.

payments/payment_gateways/stripe_subscription_sync.py (billing_interval_count guard) and payments/payment_gateways/doctype/stripe_settings/stripe_settings.py (dual Integration Request lifecycle in the embedded flow).

Reviews (11): Last reviewed commit: "feat(stripe): modern PaymentIntents chec..." | Re-trigger Greptile

Comment thread payments/payment_gateways/doctype/stripe_settings/stripe_settings.py Outdated
Comment thread payments/payment_gateways/stripe_subscription_sync.py
Comment thread payments/payment_gateways/stripe_subscription_sync.py
@Tarunkumar0601 Tarunkumar0601 force-pushed the feat/stripe-payment-intents-checkout branch from 662f47a to 75b8b35 Compare July 1, 2026 14:10
Comment thread payments/templates/pages/stripe_checkout.py
@Tarunkumar0601 Tarunkumar0601 force-pushed the feat/stripe-payment-intents-checkout branch from 75b8b35 to a698878 Compare July 1, 2026 14:51
Comment thread payments/payment_gateways/doctype/stripe_settings/stripe_settings.py Outdated
@Tarunkumar0601 Tarunkumar0601 force-pushed the feat/stripe-payment-intents-checkout branch from a698878 to 9bc0361 Compare July 1, 2026 16:12
Comment thread payments/templates/pages/stripe_checkout.py
Comment thread payments/templates/includes/stripe_checkout.js Outdated
@Tarunkumar0601 Tarunkumar0601 force-pushed the feat/stripe-payment-intents-checkout branch from 9bc0361 to 4d1a433 Compare July 1, 2026 17:02
@Tarunkumar0601 Tarunkumar0601 force-pushed the feat/stripe-payment-intents-checkout branch 2 times, most recently from b10e17c to 396cf86 Compare July 2, 2026 06:20
@Tarunkumar0601 Tarunkumar0601 force-pushed the feat/stripe-payment-intents-checkout branch from 396cf86 to 256c8cc Compare July 2, 2026 06:54
Comment thread payments/payment_gateways/doctype/stripe_settings/stripe_settings.py Outdated
@Tarunkumar0601 Tarunkumar0601 force-pushed the feat/stripe-payment-intents-checkout branch from 256c8cc to e5d0c8f Compare July 2, 2026 07:16
@Tarunkumar0601 Tarunkumar0601 force-pushed the feat/stripe-payment-intents-checkout branch from e5d0c8f to 5242cd5 Compare July 2, 2026 10:17
@Tarunkumar0601 Tarunkumar0601 force-pushed the feat/stripe-payment-intents-checkout branch from 5242cd5 to df57470 Compare July 2, 2026 12:19
@Tarunkumar0601 Tarunkumar0601 changed the title feat(stripe): modern PaymentIntents checkout (Hosted + Embedded) feat(stripe): modern paymentIntents checkout (hosted + embedded) Jul 8, 2026
@Tarunkumar0601 Tarunkumar0601 changed the title feat(stripe): modern paymentIntents checkout (hosted + embedded) feat(stripe): modern paymentintents checkout (hosted + embedded) Jul 8, 2026
if currency:
data["currency"] = currency
gateway_controller = get_gateway_controller(reference_doctype, reference_docname, payment_gateway)
settings = frappe.get_doc("Stripe Settings", gateway_controller)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use get_cached_doc instead of get_doc for Strip Settings, as it is accessed from multiple places and does not change frequently.

gateway_controller = get_gateway_controller(reference_doctype, reference_docname, payment_gateway)
settings = frappe.get_doc("Stripe Settings", gateway_controller)
result = settings.create_payment_intent_for_checkout(frappe._dict(data))
frappe.db.commit()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this db.commit() really required? If so, please use it with proper rollback handling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants